/**
 * 
 */
package io.xdag.exception;

import io.xdag.beans.BaseEnum;

/**
 * 
 * @author zhoup
 *
 */
@SuppressWarnings("serial")
public class SystemException extends BaseException {
	
	public SystemException(Throwable cause, Enum errorCode) {
		super(errorCode.text, cause,  errorCode.code);
	}

	
	public static enum Enum implements BaseEnum<Long>{
		EXPRESSION_FALSE_EXCEPTION(generateErrorCode(BaseException.Enum.BASECODE_SYSTEM_EXCEPTION,1),"表达式为Flase"), 
		EXPRESSION_NULL_EXCEPTION(generateErrorCode(BaseException.Enum.BASECODE_SYSTEM_EXCEPTION,2),"表达式为Null"), 
		EXPRESSION_IS_NOT_NULL_EXCEPTION(generateErrorCode(BaseException.Enum.BASECODE_SYSTEM_EXCEPTION,3),"表达式不为Null"), 
		EXPRESSION_IS_NOT_EQUAL_ZERO_EXCEPTION(generateErrorCode(BaseException.Enum.BASECODE_SYSTEM_EXCEPTION,4),"判断表达式不等于0"), 
		EXPRESSION_IS_EQUAL_ZERO_EXCEPTION(generateErrorCode(BaseException.Enum.BASECODE_SYSTEM_EXCEPTION,5),"判断表达式等于0"), 
		CLONE_NOT_SERIALIZABLE_EXCEPTION(generateErrorCode(BaseException.Enum.BASECODE_SYSTEM_EXCEPTION,6),"没有继承Serializable对象"),
		
		CUSTOMIZE_MESSAGE_EXCEPTION(generateErrorCode(BaseException.Enum.BASECODE_SYSTEM_EXCEPTION,999),"自定义错误信息内容"),
		;

		private Long code;

		private String text;

		Enum(Long code, String text) {
	        this.code = code;
	        this.text = text;
	    }

	    public Long getIntCode()
	    {
	    	return getCode();
	    }
	    public Long getCode() {
	        return code;
	    }

	    public void setCode(Long code) {
	        this.code = code;
	    }

	    public String getText() {
	        return text;
	    }

	    public void setText(String text) {
	        this.text = text;
	    }
	    
	    @Override
	    public String toString() {
	        return text;
	    }
		
	}
}
